/*
 * @Author: guxf
 * @Date: 2021-11-25 12:47:22
 * @Description: 用户相关接口
 */
import request from "@/utils/request.js";
const api = {
	countOrderStatus: '/applet/mine/countOrderStatus',
	getMyCoupons: '/applet/mine/couponPage',
	getMyOrders: 'customer/mine/myOrder',
	cancelOrderById: '/applet/order/cancelOrder/',
	deleteById: '/applet/order/deleteById/',
	updateClientInfo: 'applet/client/update',
	getActivityInfo: '/applet/activityRecord/getActivityInfo',
	getClientInfo : 'customer/mine/getUserInfo',
	getUserPhone: '/applet/mine/getUserPhone',
}
export function getUserPhone(phoneCode){
	return request({
	  method: "GET",
	  url: api.getUserPhone+"/?code="+phoneCode,
	});
}
/**
 * @param {Object} data客户信息
 */
export function getClientInfo() {
  return request({
    method: "GET",
    url: api.getClientInfo,
  });
}

/**
 * 我的代金券
 * @param {Object} data
 */
export function getMyCoupons(data) {
  return request({
    method: "POST",
    url: api.getMyCoupons,
	data
  });
}
/**
 * @desc 查询个人信息
 */
export function updateClientInfo(data) {
	return request({
		method: "POST",
		url: api.updateClientInfo,
		data,
	});

}
/**
 * @desc 查询个人信息
 */
export function countOrderStatus() {
	return request({
		method: "GET",
		url: api.countOrderStatus,
	});
}
/**
 * 通过id取消订单
 */
export function cancelOrderById(parameter) {
	return request({
		method: "GET",
		url: api.cancelOrderById + parameter,
	});
}
export function getMyOrders(parameter) {
	let params = parameter ? '/' + parameter : '';
	return request({
		method: "get",
		url: api.getMyOrders + params
	});
}
export function deleteById(parameter) {
	return request({
		method: "get",
		url: api.deleteById + parameter
	});
}

export function getActivityInfo() {
	return request({
		method: "get",
		url: api.getActivityInfo
	});
}
export function bindCode(data) {
	return request({
		method: "POST",
		url: '/applet/mine/addInvitationCode',
		data
	});
}